package com.hdl.client.controller;

import com.hdl.client.utils.ConsumerProxy;
import com.hdl.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 类名 RpcTestController
 * 描述 TODO
 *
 * @author hedonglin
 * @version 1.0
 * @date 2020/6/17 22:57
 */
@RestController
@RequestMapping("/test")
public class RpcTestController {

    @GetMapping("hello")
    public String sayHello(){
        UserService userService = (UserService) ConsumerProxy.createProxy(UserService.class);
        return userService.sayHello("你好啊!");
    }

    @GetMapping("hello2")
    public String sayHello2(){
        UserService userService = (UserService) ConsumerProxy.createProxy(UserService.class);
        return userService.sayHello2("王五", "你是个好人，但我们不合适!");
    }

    @GetMapping("/getResumeById/{id}")
    public String getResumeById(@PathVariable("id") Integer id){
        UserService userService = (UserService) ConsumerProxy.createProxy(UserService.class);
        return userService.getResumeById(id);
    }

}
